// import request from '@/api/system/apis.js'
import request from '@/utils/request'
import Axios from 'axios'

// 获取部门页面
export function getLayerFenceDataList(query) {
  return request({
    url: '/system/fenceInfo/findListByFenceType?disable=layer,temporary&layerId=' + query,
    method: 'get'
  })
}

// 获取监控类型围栏
export function getCameraFenceDataList(query) {
  return request({
    url: '/system/fenceInfo/findListByFenceType?fenceType=camera&layerId=' + query,
    method: 'get'
  })
}

// 添加摄像头区域
export function addCamera(query) {
  return request({
    url: '/system/cameraConfig/save',
    method: 'post',
    data: query
  })
}

// 获取图层中所有的摄像头位置数据
export function getCameraList(query) {
  return request({
    url: '/system/cameraConfig/findCameraGeoJson?layerId=' + query,
    method: 'get'
  })
}

// 按图层获取摄像头列表
export function getCameraLayerList(query) {
  return request({
    url: '/system/cameraConfig/findList?layerId=' + query,
    method: 'get'
  })
}

// 获取单个摄像头信息
export function cameraOne(query) {
  return request({
    url: '/system/cameraConfig/findByIdCameraGeoJson?idx=' + query,
    method: 'get'
  })
}

// 删除选中的摄像头
export function delCameraInfo(data) {
  return request({
    url: '/system/cameraConfig/delete',
    method: 'post',
    data: data
  })
}

// 通过围栏id获取单个围栏的数据
export function getSingeFence(query) {
  return request({
    url: '/system/fenceInfo/findByIdGeoJson?idx=' + query,
    method: 'get'
  })
}

// 获取部门树
export function getDeptTree() {
  return request({
    url: '/system/department/tree',
    method: 'post'
  })
}

// 根据部门的ID过去部门中对应的人员等信息
export function getDeptDetail(data) {
  return request({
    url: '/system/resource/findList?departmentId=' + data,
    method: 'get'
  })
}

export function getAllDeptDetail() {
  return request({
    url: '/system/resource/findList',
    method: 'get'
  })
}

export function getHistoryInfoDetail(data) {
  return request({
    url: '/system/history/playHistory',
    method: 'post',
    data: data
  })
}

// 获取围栏列表
export function getLayerFenceList(data) {
  return request({
    url: '/system/fenceInfo/findListByFenceType?disable=layer&layerId=' + data,
    method: 'get'
  })
}

// 获取区域围栏内移动轨迹数据
export function getFenceHistoryDisplayData(data) {
  return request({
    url: '/system/history/areaHistory',
    method: 'post',
    data: data
  })
}

export function loadType() {
  return request({
    url: '/system/resourceType/findList',
    method: 'get'
  })
}

export function getPosDataEx(data) {
  return request({
    url: '/system/dataHeatMapInfo/afterAggregation',
    method: 'post',
    data: data
  })
}

export function FenceAjaxLayerId(fenceUrl) {
  return request.get(fenceUrl)
}
// 加载图层所有围栏
export function getAllFence(mapid) {
  return request({
    url: '/system/fenceInfo/findListByFenceTypeGeoJson?disable=layer,temporary&layerId=' + mapid,
    // url: '/system/fenceInfo/findListByFenceTypeGeoJson?disable=layer,temporary&layerId=' + mapid+'&type=1',
    method: 'GET'
  })
}

// 加载图层中所有摄像头电子围栏
export function getAllCameraFence(mapid) {
  return request({
    url: '/system/fenceInfo/findListByFenceTypeGeoJson?fenceType=camera&layerId=' + mapid,
    method: 'GET'
  })
}

// 根据围栏id获取围栏信息
export function fenceOneInfo(mapid) {
  return request({
    url: '/system/fenceInfo/findById?idx=' + mapid,
    method: 'GET'
  })
}

// 存储围栏信息
export function addFence(data) {
  return request({
    url: '/system/fenceInfo/save',
    method: 'post',
    data: data
  })
}

// 删除围栏
export function deleteFence(data) {
  return request({
    url: '/system/fenceInfo/delete',
    method: 'post',
    data: data
  })
}

// 一键撤离
export function oneKeyOut(data) {
  return request({
    url: '/socket/display/oneKeyOut',
    method: 'post',
    data: data
  })
}


//基站添加
export function anchor(data) {
  return request({
    url: '/modules-gateway/anchor/status',
    method: 'get',
    data: data
  })
}

//单点查询
export function history(query) {
  return request({
    url: '/system/history/getDataOrgPosS',
    method: 'post',
    data: query
  })
}

//单点导出
export function exportSingleOrMoreDate(query) {
  return request({
    url: '/system/history/exportSingleOrMoreDate',
    method: 'post',
    data: query
  })
}